Definition of the XML structure (next)

<text>

The text element is used to display a text (field labels, help…). Its content is placed in the form with the view to replace some reserved HTML characters by their codes. The text element extends cell.

attributes

those of cell

eval (optional)

Name of a Java Script variable declared in the script block. The string value of this variable will be usd as content.

children

text() 0,1

Free text, sometimes surrounded by ![CDATA[ et ]] to avoid conflicts.

We can also nest elements such as section, actionhistory, text, field, html attribute.

Examples

<text>Demande</text>
<text><![CDATA[ Pierre & Paul ]]></text>
<text eval="field_Nom"/>

<attribute>

The attribute element is used to display a text. Its content is placed in the form with the view to replace some reserved characters of a HTML attribute by their codes. The attribute element extends cell.

attributes

those of cell

eval (optional)

Name of a Java Script variable declared in the script block. The string value of this variable will be usd as content.

children

text() 0,1

Free text, sometimes surrounded by ![CDATA[ et ]] to avoid conflicts.

We can also nest elements such as section, actionhistory, text, field, html attribute.

Example

<html>&gt;input type="text" value="<attribute eval="field_Nom">"&lt;</html>

<highlighted>

The highlighted element works exactly as text, except that it surrounds the text with formatting to highlight it.

The highlighted element extends cell.

attributes

those of cell

eval (optional)

Name of a Java Script variable declared in the script block. The string value of this variable will be usd as content.

children

text() 0,1 : Free text, sometimes surrounded by ![CDATA[ et ]] to avoid conflicts.

We can also nest elements such as section, actionhistory, text, field, html attribute.

Examples

<highlighted>Demande</highlighted>
<highlighted><![CDATA[ Pierre & Paul ]]></highlighted>
<highlighted eval="field_Nom"/>

<get>

The get element displays the value of a system field.

attributes

name

System name available from the list below:

procedure.label

Returns the process label

stage.label

returns the label of the current stage

treatment.openurl

returns the documents access URL. Used in mail forms.

comment

available when sending information email.

returns the comment typed by the user.

children

none

Examples

<get name="procedure.label"/>
<get name="stage.label"/>

<actionhistory>

The actionhistory element represents a history display control of actions performed at a given stage and associated action fields. For this version, it is limited to a single line, which if it exists, describes the last action performed at this stage. We can set the display of : the decision, date, contributor, his role, action comments and action fields. By default, all these fields will be displayed.

Example:

Refuse decision taken on 22/10/2003 13:34 by Roch as Chef de service

Reason: Everything is possible!

The actionhistory element extends cell.

attributes

those of cell

stage

System name of the concerned stage. Ex: request

action (optional)

Displays the decision, 1 or 0 (displayed or not) by default 1.

date (optional)

Displays the date , 1 or 0 (displayed or not) by default 1.

fulfiller (optional)

Displays the contributor, 1 or 0 (displayed or not) by default 1.

role (optional)

Displays his role, 1 or 0 (displayed or not) by default 1.

comment (optional)

Displays the action comment, 1 or 0 (displayed or not) by default 1.

fields (optional)

Displays the action field, 1 or 0 (displayed or not) by default 1.

children

none

Examples

<actionhistory stage="demande"/>

<include>

The include element does not have any representation. It is useful to include sub-forms.

The include element extends cell.

attributes

those of cell

subform

System name of the subform to include.

children

none

Two examples of including sub-forms

<!--
  Step form stgCREATION :
  Including the sub-form named sys_stgCREATION_Edit
-->
<page>
  <body>
    <include subform="sys_stgCREATION_Edit" />
  </body>
</page>

<!--
  Step sub-form sys_stgCREATION_Edit :
  Including the sub-forms named dm.edit et dm.edit
-->
<section labelid="documentManagement_1.0:ActionStage:stgCREATION:label" class="section-highlighted" helpid="stgCREATION" descriptionid="documentManagement_1.0:ActionStage:stgCREATION:description">
  <include subform="dm.script" />
  <include subform="dm.edit" />
  <actionhistory stage="stgCREATION" fields="1" />
</section>

<fragment>

The fragment element does not have any representation. It is useful to surround elements.

The col element extends container and cell.

attributes

those of cell

id (optional)

Defines the identifier enabling to find the fragment to display or hide it.

children

those of container

Example of using fragments to surround elements

<line>
  <fragment id="marker.DelaiConfime.Required">
    <col width="25" class="cell-left">
      <highlighted>* <text labelid="Property:DelaiConfime:label"
        descriptionid="Property:DelaiConfime:description" /></highlighted>
    </col>
    <col class="cell-right">
      <field property="DelaiConfime" ctrl="date" mode="write" required="yes" />
    </col>
  </fragment>
  <fragment id="marker.DelaiConfime.NotRequired">
    <col width="25" class="cell-left">
      <text labelid="Property:DelaiConfime:label" 
        descriptionid="Property:DelaiConfime:description" />
    </col>
    <col class="cell-right">
      <field property="DelaiConfime" ctrl="date" mode="write" required="no" />
    </col>
  </fragment>
</line>

Example of using a controller to display and hide fragments

In this example is also presented the way to make a field compulsory.

<script>
        function onAfterLoad()
        {
          var controller = iWorkflowModule.getController( iWorkflowInstance );
        
          if ( "UneEtapeParticuliere" == iTaskInstance.getTask().getName() )
          {
            controller.showBodyBlock("marker.DelaiConfime.Required",false);
            controller.showBodyBlock("marker.DelaiConfime.NotRequired",true);
            controller.setMandatory("DelaiConfime",false);
          }
          else
          {
            controller.showBodyBlock("marker.DelaiConfime.Required",true);
            controller.showBodyBlock("marker.DelaiConfime.NotRequired",false);
            controller.setMandatory("DelaiConfime,true);
          }
        }
</script>

<button>

The button element lets position a graphical button inside the form as an element text.

attributes

those of cell

onclick (rarely advised)

Java Script code that will be processed

children

text() 1,1

It is recommended to use ![CDATA[ et ]] to avoid conflicts.

We can also nest elements such as section, actionhistory, text, field, html attribute.

Some simple examples

<button label="Hello VDoc" onclick="alert('Hello VDoc !!!')"/>

<button label="Hello VDoc"><![CDATA[
  log.info("Hello VDoc");
  alert("Hello VDoc !");
]]></button>

Displaying and hiding elements using buttons

In this example it is shown how to display and hide an identified area using buttons.

<line>
  <col>
    <button label="Cacher" onclick="show('marker.Text',false)"/>
    <button label="Montrer" onclick="show('marker.Text',true)"/><br/>
    <text id="marker.Text">Ceci est un bloc de texte</text>
  </col>
</line>

Increasing the task delay from the document

In this example, several treatments are made:

  • Increasing the delay of the active task;
  • Adding an event in the history;
  • Sending information email;
  • Closing the document.
    <button label="Increase task delay"><![CDATA[
      // recover the task definition from the active task
      var iTask = iTaskInstance.getTask();
      
      // calculation of the new date in milliseconds (2 more days)
      var delayMillis = (2) * 24 * 60 * 60 * 1000;
      var maxEndedDateMillis = iTaskInstance.getCreatedDate().getTime() + delayMillis;
      
      // transformation in Date
      var maxEndedDate = new java.util.Date( maxEndedDateMillis );
      iTaskInstance.setMaxEndedDate( maxEndedDate );
      
      // this comment will be placed in the history
      var delayComment = "Délai repoussé" ;
      
      // adding the event in the history
      iWorkflowInstance.getHistory().addEvent( "Augmenter le délai", iTask.getLabel(), iUser, iUser, 
        delayComment, iTask.getRole().getLabel() );
    
      // sending the information message
      var iMailForm = iTask.getMailForm( 3 ); // IMailForm.INFORMATION = 3
      if ( iMailForm.isActive() )
        iWorkflowModule.send(iContext, iTaskInstance, iMailForm, delayComment );
      
      // Recover a controller to handle form buttons
      var resourceController = iWorkflowModule.getController(iWorkflowInstance);
    
      // Recover the document closing button and simulate the document closing
      var button = resourceController.getTopButton( "close" );
      resourceController.execute( button ); 
    ]]></button>